
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class singlePlayerInfoEntry extends JLabel implements MouseListener
{
	static ImageIcon playersInfoEntryBorder = new ImageIcon("images/border.png");
	ImageIcon color = new ImageIcon("images/color.png");
	ImageIcon forwardImage = new ImageIcon("images/forward.png");
	ImageIcon backImage = new ImageIcon("images/back.png");

	JTextField firstPlayerName;

	JLabel firstPlayerColor;
	JLabel forward;
	JLabel back;

	Color firstColor;

	public singlePlayerInfoEntry()
	{
		super(playersInfoEntryBorder);
		setBounds(430, 100, 300, 300);
		setVisible(true);

		firstPlayerName = new JTextField("Player 1");
		firstPlayerName.setBounds(75, 30, 150, 20);
		firstPlayerName.setBackground(new Color(70, 184, 38));
		add(firstPlayerName);

		firstPlayerColor = new JLabel(color);
		firstPlayerColor.setBounds(125, 60, 50, 50);
		firstPlayerColor.setCursor(new Cursor(12));
		firstPlayerColor.addMouseListener(this);
		add(firstPlayerColor);

		forward = new JLabel(forwardImage);
		forward.setBounds(230, 240, 40, 35);
		forward.setCursor(new Cursor(12));
		forward.setToolTipText("Start Game");
		forward.addMouseListener(this);
		add(forward);

		back = new JLabel(backImage);
		back.setBounds(30, 240, 40, 35);
		back.setCursor(new Cursor(12));
		back.setToolTipText("Back");
		back.addMouseListener(this);
		add(back);
		
	}

	public void mouseClicked(MouseEvent e)
	{
	}

	public void mouseEntered(MouseEvent e)
	{
		ImageIcon colorHover = new ImageIcon("images/colorHover.png");
		ImageIcon forwardHover = new ImageIcon("images/forwardHover.png");
		ImageIcon backHover = new ImageIcon("images/backHover.png");

		if(e.getSource() == firstPlayerColor)
		{
			firstPlayerColor.setIcon(colorHover);
		}
		else
		{
			if(e.getSource() == forward)
			{
				forward.setIcon(forwardHover);
			}
			else
			{
				if(e.getSource() == back)
				{
					back.setIcon(backHover);
				}
			}
		}
	}

	public void mouseExited(MouseEvent e)
	{
		firstPlayerColor.setIcon(color);
		forward.setIcon(forwardImage);
		back.setIcon(backImage);
	}

	public void mousePressed(MouseEvent e)
	{
	}

	public void mouseReleased(MouseEvent e)
	{
		if(e.getSource() == firstPlayerColor)
		{
			firstColor = JColorChooser.showDialog(firstPlayerColor,"Choose Stone Color",null);
			firstPlayerName.setBackground(firstColor);
		}
	}
}
